<include file="public@header" />
</head>

<body>
	<div class="wrap js-check-wrap">
		 

        <table class="table table-bordered table-hover" style="text-align: center;">
        	<thead>
        		<tr>
        			<th style="text-align: center;" >用户名</th> 
        			<th style="text-align: center;" >操作</th>
        		</tr>
        	</thead>
        	<tbody>
                <volist name="$userList" id="vo">
        		<tr>
        			<td>  <?php if( in_array( $vo['id'] , $spUid ) ) echo '<span class="glyphicon glyphicon-user" title="超级管理员"></span>';?> {$vo.user_login}</td>
                    <td><a class="btn btn-primary btn-sm" onclick="resetpwd({$vo.id});">重置密码</a></td>
        		</tr>
            </volist>
        	</tbody>
        </table>
		
		<div class="pagination">{$userList->render()}</div>
	</div>
	
	<script src="__STATIC__/js/admin.js"></script>
    <script src="__STATIC__/js/layer/layer.js"></script>
<script>


</script>

<script>


var resetpwd = function( id ){
	layer.open({
		type:2,
		title:'重置密码',
		area: ['400px', '250px'],
		fixed: false, //不固定
		maxmin: true,
		btn:['提交','取消'],
		content: '{:url("admin/companyUser/resetpwd")}?uid='+id,
		yes:function(index ){
			var res = window["layui-layer-iframe" + index].callbackdata();
			if( res.pwd.length == 0 || res.repwd.length==0 ){
				layer.msg('密码不能为空！');
				return false;
			}
			if( res.pwd.length <6 ){
				layer.msg('密码长度为6-16位！');
				return false;
			}
			$.post( '{:url("admin/companyUser/pwdPost")}' , res , function(data){
				let icon = ( data.code == 200 ) ? 1 : 5;
				layer.msg( data.message , {time:2000, icon:icon},function(){
					if(icon == 1 ){
						layer.close(index);
					}
				});
			},'json');
		}
	});
}
</script>
</body>
</html>